Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set generic type of SimpleCookie #1018

Merged
merged 1 commit into from
Jun 23, 2022
Merged

Set generic type of SimpleCookie #1018

merged 1 commit into from
Jun 23, 2022

Conversation

w0rp
Copy link
Contributor

@w0rp w0rp commented Jun 23, 2022

Pyright complains about response.cookies because the generic type isn't known. str may or may not be the correct type to use here. Something should be set here.

Related issues

There are no related issues. I just saw this in my editor and wanted to point it out here.

Pyright complains about `response.cookies` because the generic type isn't known. `str` may or may not be the correct type to use here. Something should be set here.
@@ -17,7 +17,7 @@ class ContentNotRenderedError(Exception): ...
class SimpleTemplateResponse(HttpResponse):
content: Any = ...
closed: bool
cookies: SimpleCookie
cookies: SimpleCookie[str]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or bytes? Can you please double check that?

Copy link
Contributor Author

@w0rp w0rp Jun 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's meant to be str.

I also just noticed there are other instances of SimpleCookie in the codebase without type parameterts, such as in test/client.pyi. Maybe someone more familiar with cookies will come along and fix these types.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! Please, feel free to fix other cookies as well!

@sobolevn sobolevn merged commit 6440521 into typeddjango:master Jun 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants